/**
 * Created by Coing on 2017/2/26.
 */
public class Solution1 {

    public int strStr(String haystack, String needle) {
        for (int i = 0; ; i++) {
            for (int j = 0; ; j++) {
                if (j == needle.length()) return i;
                if (i + j == haystack.length()) return -1;
                if (needle.charAt(j) != haystack.charAt(i + j)) break;
            }
        }

    }
    public static void main(String[] args) {
        Solution1 solution = new Solution1();
        System.out.println(solution.strStr("", ""));
        System.out.println("**********");
        System.out.println(solution.strStr("abc", "bc"));
        System.out.println("**********");
        System.out.println(solution.strStr("aab", "aa"));
        System.out.println("**********");
        System.out.println(solution.strStr("sdklaff", "ad"));
        System.out.println("**********");
        System.out.println(solution.strStr("mississippi", "issipi"));
        System.out.println("**********");

    }
}
